[Oracle] rman 参数配置(advanced)


本文总阅读量

1、设置每个通道创建备份集的最大值:

CONFIGURE MAXSETSIZE TO UNLIMITED; # default
设置每个通道能够创建备份集的最大值为1G;
CONFIGURE MAXSETSIZE TO 1 G;
使用backupset备份时,如果存在某个表空间文件大于1G,则会提示报错

1
2
RMAN-03002: failure of backup command at 04/13/2019 23:32:46
RMAN-06183: datafile or datafile copy /data/u01/app/oracle/oradata/boston/sysaux01.dbf (file number 2) larger than MAXSETSIZE

2、设置每个通道创建备份块的最大值,如果达到最大值会创建下一个备份块

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
如果系统参数配置了多个通道,可以直接添加maxpiecesize:
CONFIGURE CHANNEL 1 DEVICE TYPE DISK MAXPIECESIZE 100 M;
CONFIGURE CHANNEL 2 DEVICE TYPE DISK MAXPIECESIZE 50 M;
CONFIGURE CHANNEL 3 DEVICE TYPE DISK MAXPIECESIZE 50 M;

RMAN> backup as compressed backupset full database format '/tmp/backuporacle/db_%d_%T_%U';
Starting backup at 2019:04:14 00:17:11
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
......
channel ORA_DISK_3: finished piece 1 at 2019:04:14 00:17:15
piece handle=/tmp/backuporacle/db_BOSTON_20190414_kituu587_1_1 tag=TAG20190414T001711 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_2: finished piece 1 at 2019:04:14 00:17:19
piece handle=/tmp/backuporacle/db_BOSTON_20190414_khtuu587_1_1 tag=TAG20190414T001711 comment=NONE
channel ORA_DISK_2: starting piece 2 at 2019:04:14 00:17:19
channel ORA_DISK_2: finished piece 2 at 2019:04:14 00:17:26
piece handle=/tmp/backuporacle/db_BOSTON_20190414_khtuu587_2_1 tag=TAG20190414T001711 comment=NONE
channel ORA_DISK_2: starting piece 3 at 2019:04:14 00:17:26
channel ORA_DISK_1: finished piece 1 at 2019:04:14 00:17:29
piece handle=/tmp/backuporacle/db_BOSTON_20190414_kgtuu587_1_1 tag=TAG20190414T001711 comment=NONE
channel ORA_DISK_1: starting piece 2 at 2019:04:14 00:17:29
channel ORA_DISK_2: finished piece 3 at 2019:04:14 00:17:36
piece handle=/tmp/backuporacle/db_BOSTON_20190414_khtuu587_3_1 tag=TAG20190414T001711 comment=NONE
channel ORA_DISK_2: starting piece 4 at 2019:04:14 00:17:36
channel ORA_DISK_2: finished piece 4 at 2019:04:14 00:17:43
piece handle=/tmp/backuporacle/db_BOSTON_20190414_khtuu587_4_1 tag=TAG20190414T001711 comment=NONE
channel ORA_DISK_2: starting piece 5 at 2019:04:14 00:17:43
channel ORA_DISK_1: finished piece 2 at 2019:04:14 00:17:44
piece handle=/tmp/backuporacle/db_BOSTON_20190414_kgtuu587_2_1 tag=TAG20190414T001711 comment=NONE
channel ORA_DISK_1: starting piece 3 at 2019:04:14 00:17:44
channel ORA_DISK_2: finished piece 5 at 2019:04:14 00:17:45
piece handle=/tmp/backuporacle/db_BOSTON_20190414_khtuu587_5_1 tag=TAG20190414T001711 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:34
channel ORA_DISK_1: finished piece 3 at 2019:04:14 00:17:59
piece handle=/tmp/backuporacle/db_BOSTON_20190414_kgtuu587_3_1 tag=TAG20190414T001711 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:48
Finished backup at 2019:04:14 00:17:59

备份完成之后的文件大小如下所示:

1
2
3
4
5
6
7
8
9
-rw-r-----. 1 oracle oinstall 5.1M 4月  14 00:17 db_BOSTON_20190414_kituu587_1_1
-rw-r-----. 1 oracle oinstall 49M 4月 14 00:17 db_BOSTON_20190414_khtuu587_1_1
-rw-r-----. 1 oracle oinstall 49M 4月 14 00:17 db_BOSTON_20190414_khtuu587_2_1
-rw-r-----. 1 oracle oinstall 99M 4月 14 00:17 db_BOSTON_20190414_kgtuu587_1_1
-rw-r-----. 1 oracle oinstall 49M 4月 14 00:17 db_BOSTON_20190414_khtuu587_3_1
-rw-r-----. 1 oracle oinstall 49M 4月 14 00:17 db_BOSTON_20190414_khtuu587_4_1
-rw-r-----. 1 oracle oinstall 99M 4月 14 00:17 db_BOSTON_20190414_kgtuu587_2_1
-rw-r-----. 1 oracle oinstall 4.4M 4月 14 00:17 db_BOSTON_20190414_khtuu587_5_1
-rw-r-----. 1 oracle oinstall 44M 4月 14 00:17 db_BOSTON_20190414_kgtuu587_3_1

通道1备份的数据块小于100M,通道2、通道3备份的数据块小于50M
也可以在run命令下,分配通道时手动指定参数,如下所示:

1
2
3
4
5
6
run {
allocate channel t1 type disk maxpiecesize = 50M;
allocate channel t2 type disk maxpiecesize = 80M;
allocate channel t3 type disk;
backup as compressed backupset full database format '/tmp/backuporacle/db_%d_%T_%U';
}

3、完全备份数据时,单独排除某一个数据库不备份

CONFIGURE EXCLUDE FOR TABLESPACE users;
开始备份,tablespace users被自动过滤掉,没有备份:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
RMAN> backup as compressed backupset full database format '/tmp/backuporacle/db_%d_%T_%U';
Starting backup at 2019:04:14 00:32:50
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=397 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=585 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=12 device type=DISK
file 4 is excluded from whole database backup
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00002 name=/data/u01/app/oracle/oradata/boston/sysaux01.dbf
input datafile file number=00003 name=/data/u01/app/oracle/oradata/boston/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 2019:04:14 00:32:51
channel ORA_DISK_2: starting compressed full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00001 name=/data/u01/app/oracle/oradata/boston/system01.dbf
input datafile file number=00005 name=/data/u01/app/oracle/oradata/boston/test001.dbf
channel ORA_DISK_2: starting piece 1 at 2019:04:14 00:32:51
channel ORA_DISK_2: finished piece 1 at 2019:04:14 00:32:58
piece handle=/tmp/backuporacle/db_BOSTON_20190414_kltuu65j_1_1 tag=TAG20190414T003251 comment=NONE
channel ORA_DISK_2: starting piece 2 at 2019:04:14 00:32:58
channel ORA_DISK_2: finished piece 2 at 2019:04:14 00:33:05
piece handle=/tmp/backuporacle/db_BOSTON_20190414_kltuu65j_2_1 tag=TAG20190414T003251 comment=NONE
channel ORA_DISK_2: starting piece 3 at 2019:04:14 00:33:05
channel ORA_DISK_1: finished piece 1 at 2019:04:14 00:33:06
piece handle=/tmp/backuporacle/db_BOSTON_20190414_kktuu65j_1_1 tag=TAG20190414T003251 comment=NONE
channel ORA_DISK_1: starting piece 2 at 2019:04:14 00:33:06
channel ORA_DISK_2: finished piece 3 at 2019:04:14 00:33:13
piece handle=/tmp/backuporacle/db_BOSTON_20190414_kltuu65j_3_1 tag=TAG20190414T003251 comment=NONE
channel ORA_DISK_2: starting piece 4 at 2019:04:14 00:33:13
channel ORA_DISK_2: finished piece 4 at 2019:04:14 00:33:20
piece handle=/tmp/backuporacle/db_BOSTON_20190414_kltuu65j_4_1 tag=TAG20190414T003251 comment=NONE
channel ORA_DISK_2: starting piece 5 at 2019:04:14 00:33:20
channel ORA_DISK_1: finished piece 2 at 2019:04:14 00:33:21
piece handle=/tmp/backuporacle/db_BOSTON_20190414_kktuu65j_2_1 tag=TAG20190414T003251 comment=NONE
channel ORA_DISK_1: starting piece 3 at 2019:04:14 00:33:21
channel ORA_DISK_2: finished piece 5 at 2019:04:14 00:33:22
piece handle=/tmp/backuporacle/db_BOSTON_20190414_kltuu65j_5_1 tag=TAG20190414T003251 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:31
channel ORA_DISK_1: finished piece 3 at 2019:04:14 00:33:36
piece handle=/tmp/backuporacle/db_BOSTON_20190414_kktuu65j_3_1 tag=TAG20190414T003251 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
Finished backup at 2019:04:14 00:33:36

4、配置snapshot control file location

因为控制文件一直是在适时刷新的,不能确保数据文件和控制文件的一致性,因此rman在备份和同步recovery catalog时会用到snapshot control file,开始备份时会创建或者更新(如果snapshot controlfile 存在)snapshot controlfile,之后rman使用snapshot controlfile进行备份和同步。
snapshot controlfile这是在rman备份和同步的时候才会用到,oracle在创建表空间、切换日志、执行检查点并不会把信息写到snapshot controlfile下。

rman查看snapshot controlfile

1
2
3
RMAN> show snapshot controlfile name;
RMAN configuration parameters for database with db_unique_name BOSTON are:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/home/oracle/snapcf_boston.f';

修改snapshot controlfile路径CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘/root/snap_boston.ctl’;
设置的路径oralce用户必须有访问权限,如果没有访问权限,会报下面错误:

1
2
3
4
5
6
ORA-01580: error creating control backup file /root/snap_boston.ctl
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 13: Permission denied
Additional information: 6

RMAN-08132: WARNING: cannot update recovery area reclaimable file list
目录
  1. 1. 1、设置每个通道创建备份集的最大值:
  2. 2. 2、设置每个通道创建备份块的最大值,如果达到最大值会创建下一个备份块
  3. 3. 3、完全备份数据时,单独排除某一个数据库不备份
  4. 4. 4、配置snapshot control file location

Proudly powered by Hexo and Theme by Lap
本站访客数人次
© 2020 zeven0707's blog